<template>
  <div class="pass_container">
    <el-steps
      :active="3"
      class="steps"
    >
      <!-- 第一步 -->
      <el-step
        title="身份验证"
        icon="iconfont icon-yanzheng"
      ></el-step>

      <!-- 第二步 -->
      <el-step
        title="修改密码"
        icon="iconfont icon-xiugaimima"
      ></el-step>

      <!-- 第三步 -->
      <el-step
        title="成功"
        icon="el-icon-success"
      ></el-step>
    </el-steps>

    <div class="pass_box">
      <el-form
        :model="passForm"
        :rules="rules"
        ref="passForm"
        class="demo-passForm"
      >
        <p>密码修改成功</p>
        <!-- 注册按钮 -->
        <el-form-item class="btn">
          <el-button
            type="primary"
            @click="login"
          >立即登录</el-button>
        </el-form-item>
      </el-form>
    </div>

  </div>

</template>

<script>
export default {
  data() {
    //初始密码
    var validatePass = (rule, value, callback) => {
      if (value === "") {
        callback(new Error("请输入密码"));
      } else {
        if (this.regFrom.checkPass !== "") {
          this.$refs.regFrom.validateField("checkPass");
        }
        callback();
      }
    };

    //确认密码
    var validatePass2 = (rule, value, callback) => {
      if (value === "") {
        callback(new Error("请再次输入密码"));
      } else if (value !== this.regFrom.pass) {
        callback(new Error("两次输入密码不一致!"));
      } else {
        callback();
      }
    };
    return {
      passForm: {
        pass: "", //密码
        checkPass: "", //确认密码
      },
      rules: {
        pass: [{ validator: validatePass, trigger: "blur" }],
        checkPass: [{ validator: validatePass2, trigger: "blur" }],
      },
    };
  },
  components: {},
  methods:{
    login(){
        this.$router.push({ path: "/login" }); //页面路由跳转
    },
  }
};
</script>

<style lang='less' scoped>
.pass_container {
  min-width: 1024px;
  min-height: 640px;
  height: 100%;
}
.steps {
  padding-top: 50px;
  width: 576px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.pass_box {
  display: block;
  width: 400px;
  height: 330px;
  border-radius: 5px; // 圆角
  position: absolute;
  top: 130px;
  left: 0;
  right: 0;
  margin: auto;
  //   top: 40%;
  //   left: 50%;
  //   transform: translate(-50%, -50%); // 根据自己位置 以自己为长度位移

  .demo-passForm {
    position: absolute;
    width: 100%;
    padding: 10px 20px;
    box-sizing: border-box; // 设置边框

    p {
      font-weight: bold;
      font-size: 35px;
      display: flex; // 弹性布局
      justify-content: center; // 居中对齐
    }
    .btn{
      display: flex; // 弹性布局
      justify-content: center; // 居中对齐
    }
  }
}
</style>
